package com.example.home_pc.ddmslifetime;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {
    private static final String ACTIVITY_TAG="MainActivity";
    private Button bt;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Log.v(MainActivity.ACTIVITY_TAG,"FirstActivity ---> onCreate.");
        bt = (Button)findViewById(R.id.bt);
        bt.setText("启动第二个活动");
        bt.setOnClickListener(new Button.OnClickListener(){
            @Override
            public void onClick(View v){
                Intent intent = new Intent();
                intent.setClass(MainActivity.this,Activity2.class);
                MainActivity.this.startActivity(intent);
            }
        });
    }

    @Override
    protected void onDestroy(){
        Log.v(MainActivity.ACTIVITY_TAG,"FirstActivity ---> onDestroy.");
        super.onDestroy();
    }

    @Override
    protected void onPause(){
        Log.v(MainActivity.ACTIVITY_TAG,"FirstActivity ---> onPause.");
        super.onPause();
    }

    @Override
    protected void onRestart(){
        Log.v(MainActivity.ACTIVITY_TAG,"FirstActivity ---> onRestart.");
        super.onRestart();
    }

    @Override
    protected void onResume(){
        Log.v(MainActivity.ACTIVITY_TAG,"FirstActivity ---> onResume.");
        super.onResume();
    }

    @Override
    protected void onStart(){
        Log.v(MainActivity.ACTIVITY_TAG,"FirstActivity ---> onStart.");
        super.onStart();
    }

    @Override
    protected void onStop(){
        Log.v(MainActivity.ACTIVITY_TAG,"FirstActivity ---> onStop.");
        super.onStop();
    }
}
